package org.xdq.观察者模式2;

import java.util.Observable;//java提供的抽象的目标对象

public class Goods extends Observable {

    private boolean stealed;//是否被盗窃

    private Security security;

    public void setSecurity(Security security) {
        this.security = security;
    }

    public Security getSecurity() {
        return security;
    }

    public void steal(){
        this.stealed = true;
        this.setChanged();//声明状态改变
        this.notifyObservers();//通知所有观察者

    }

    public boolean isStealed() {
        return stealed;
    }
}
